import Vue from 'vue'
import ElementUI from 'element-ui'
import 'element-ui/lib/theme-chalk/index.css'
import App from './App.vue'
import router from './router'
import store from './store'
import './permission'

//引用富文本编辑器
import VueQuillEditor from 'vue-quill-editor'
//引入富文本css
import 'quill/dist/quill.core.css'
import 'quill/dist/quill.snow.css'
import 'quill/dist/quill.bubble.css'

import * as echarts from 'echarts'
import vueCompositionApi from '@vue/composition-api'


// //xlxs
// import FileSaver from 'file-saver'
// import XLSX from 'xlsx'

//引用公用样式
// import './untils/commonL.css'
import './untils/commonL2.css'

import MyConsole from './untils/MyConsole.js'

//权限 查询
function PowwerSelect(power, menucode) {
  if (power == '-1') {
    return true;
  }
  if (menucode == undefined || menucode == '') {
    return false;
  }
  return power.indexOf(menucode + ".Select") > -1;
}
//权限 导出
function PowerExport(power, menucode) {
  if (power == '-1') {
    return true;
  }
  if (menucode == undefined || menucode == '') {
    return false;
  }
  return power.indexOf(menucode + ".Export") > -1;
}

//权限 删除
function PowerDelete(power, menucode) {
  if (power == '-1') {
    return true;
  }
  if (menucode == undefined || menucode == '') {
    return false;
  }
  return power.indexOf(menucode + ".Delete") > -1;
}
//权限 操作员
function PowerAction(power, menucode) {
  if (power == '-1') {
    return true;
  }
  if (menucode == undefined || menucode == '') {
    return false;
  }
  return power.indexOf(menucode + ".Action") > -1;
}
//权限 修改
function PowerUpdate(power, menucode) {
  if (power == '-1') {
    return true;
  }
  if (menucode == undefined || menucode == '') {
    return false;
  }
  return power.indexOf(menucode + ".Update") > -1;
}
//权限 新增
function PowerAdd(power, menucode) {
  if (power == '-1') {
    return true;
  }
  if (menucode == undefined || menucode == '') {
    return false;
  }
  return power.indexOf(menucode + ".Add") > -1;
}
//权限 启用 禁用
function PowerEnable(power, menucode) {
  if (menucode=="AuthBZ.FlowEdit") {
    
  }
  if (power == '-1') {
    return true;
  }
  if (menucode == undefined || menucode == '') {
    return false;
  }
  return power.indexOf(menucode + ".Enable") > -1;
}
//获取guid
function getGuid() {
  return "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(
    /[xy]/g,
    function (c) {
      var r = (Math.random() * 16) | 0,
        v = c == "x" ? r : (r & 0x3) | 0x8;
      return v.toString(16);
    }
  );
}
//获取字符串宽度
function getStringWidth(text) {
  let span = document.createElement('span');
  span.innerHTML = text;
  span.style.visibility = 'hidden';
  span.setAttribute('class','fontSize');
  let width = span.offsetWidth;
  document.getElementsByTagName('body')[0].removeChild(span);
  return width;
}

var loading;
//遮罩层 开启
function openLoading() {
  loading = this.$loading({
      lock: true,
      text: "加载中",
      spinner: "el-icon-loading",
      background: "rgba(0, 0, 0, 0.7)",
  });
}
//遮罩层 关闭
function closeLoading() {
  loading.close();
}

Vue.prototype.$LogInfo = MyConsole.LogInfo
Vue.prototype.$LogError = MyConsole.LogError
Vue.prototype.$LogWarning = MyConsole.LogWarning
Vue.prototype.$LogSuccess = MyConsole.LogSuccess
Vue.prototype.$LogPicture = MyConsole.LogPicture
Vue.prototype.$LogTable = MyConsole.LogTable

Vue.prototype.$PowerSelect = PowwerSelect
Vue.prototype.$PowerExport = PowerExport
Vue.prototype.$PowerDelete = PowerDelete
Vue.prototype.$PowerAction = PowerAction
Vue.prototype.$PowerUpdate = PowerUpdate
Vue.prototype.$PowerAdd = PowerAdd
Vue.prototype.$PowerEnable = PowerEnable
Vue.prototype.$GetGuid = getGuid
Vue.prototype.$GetStringWidth = getStringWidth


Vue.prototype.openLoading = openLoading
Vue.prototype.closeLoading = closeLoading


Vue.use(ElementUI,{size:'small'});
//富文本编辑器添加实例
Vue.use(VueQuillEditor)

Vue.config.productionTip = false

Vue.prototype.$echarts = echarts

new Vue({
  router,
  store,
  render: h => h(App)
}).$mount('#app')


